$(function() {
	var userGrid = $("#studentLeftGrid");
	userGrid.datagrid({
		url: 'classes/studentlist',
		fit: true,
		pagination: false,
		border: false,
		fitColumns:true,
		columns: [
			[{
				field: 'checkbox',
  				width: 100,
				align: 'center',
				checkbox: true,
				hidden: false
			}, {
				field: 'id',
				width: 20,
				align: 'center',
				hidden: true
			}, {
				field: 'name',
				title: '学生姓名',
				align: 'center',
				width: 50,
				hidden: false
			}, {
				field: 'education',
				title: '学历',
				align: 'center',
				width: 50,
				hidden: false
			}]
		]
	});
	var ed = $("#educaTion");
	//检索
	$("#edSearch").on("click",function(){
		userGrid.datagrid("load",{
			education:ed.val()
		});
	});
	//重置
	var form = $("#stuSearchForm");
	$("#edReset").on('click', function() {
		ctag = 0;
		form.form('clear');
		// 清除查询参数
		userGrid.datagrid("load", {});
	});  
	
	$("#moveinbtn").on("click",function(){
		 var checkeds = $('#studentLeftGrid').datagrid('getChecked');  
	        var idStr = '';  
	        for(var i = 0; i < checkeds.length; i++){  
	            idStr += checkeds[i].id + ",";  
	        }  
	        if(idStr.length == 0){  
	        	$.messager.alert('提示','请选择要移入的学生');
	            return;  
	        }  
	        var ids = new Array();
	        for(var j = 0;j<checkeds.length;j++){
	        	ids[j] = checkeds[j].id;
	        }
	        var tag = 0;
	        $.post("classes/famentstudentlist/"+ids+"/"+tag, null, function(rs) {
				if (rs.success) {
					//刷新数据表格
					$("#studentRightGrid").datagrid("reload");
					userGrid.datagrid("reload");
				} else {
					$.messager.alert("提示", rs.message);
					
				}
			});

	});
});